export function generateUniqueId (card, roleType, index) {
    // 示例生成规则：角色类型+时间戳+牌面信息+位置索引
    return `${roleType}-${Date.now()}-${card.rank}-${card.suit.log}-${index}`;
  }
  //计算下一个玩家id
  export function getNextPlayerId(currentPlayerId,players) {
    console.log(players)
    // 直接通过ID查找当前玩家对象
    const currentPlayer = players.find(p => p.id ===  String(currentPlayerId));
    if (!currentPlayer) {
      console.error(`找不到玩家ID: ${currentPlayerId}`);
      return null;
    }
  
    // 计算下一个sx（1→2→3→1循环）
    const nextSx = (currentPlayer.sx % 3) + 1;
  
    // 查找下一个玩家
    const nextPlayer = players.find(p => p.sx === nextSx);
    if (!nextPlayer) {
      console.error(`未找到sx=${nextSx}的玩家`);
      return null;
    }
  
    return nextPlayer.id;
  }